﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Test.Common;

namespace Test.IDAL
{
    public interface IBaseDAL<T>
    {
       
        /// <summary>
        /// 查询集合
        /// </summary>
        /// <param name="expression">表达式</param>
        /// <returns>List集合</returns>
        OperResult< List<T>> Select(Expression<Func<T, bool>> expression);

        /// <summary>
        /// 查询单个对象
        /// </summary>
        /// <param name="expression">表达式</param>
        /// <returns>单个对象或null</returns>
        OperResult<T> Single(Expression<Func<T, bool>> expression);

        /// <summary>
        /// 查询单个对象
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns>单个对象或null</returns>
        OperResult< T> Single(int id);

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="info">数据</param>
        /// <returns>受影响的行数</returns>
        OperResult<int>  Insert(T info);


        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="info">数据</param>
        /// <returns>受影响的行数</returns>
        OperResult<int>  Delete(T info);
        

    }
}
